<template>
  <div class="app-container">
    <div v-if="user">
      <el-row :gutter="20">

        <el-col :span="6" :xs="24">
          <user-card :user="userInfo"/>
        </el-col>

        <el-col :span="18" :xs="24">
          <el-card>
            <el-tabs v-model="activeTab">
              <el-tab-pane label="Activity" name="activity">
                <activity/>
              </el-tab-pane>
              <!--              <el-tab-pane label="Timeline" name="timeline">-->
              <!--                <timeline />-->
              <!--              </el-tab-pane>-->
              <!--              <el-tab-pane label="Account" name="account">-->
              <!--                <account :user="user" />-->
              <!--              </el-tab-pane>-->
              <el-tab-pane label="绑定人脸识别" name="face">
                <face :userInfo="userInfo" :typeBoolean="true" />
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col>

      </el-row>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import UserCard from './components/UserCard'
import Activity from './components/Activity'
import Timeline from './components/Timeline'
import Account from './components/Account'
import Face from '@/views/profile/components/Face'

export default {
  name: 'Profile',
  components: { Face, UserCard, Activity, Timeline, Account },
  data() {
    return {
      userInfo: {},
      activeTab: 'activity'
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'avatar',
      'roles',
      'user'
    ])
  },
  created() {
    this.getUser()
  },
  methods: {
    getUser() {
      this.userInfo = {
        name: this.user.nickName,
        role: this.roles.join(' | '),
        header: this.user.header
      }
    }
  }
}
</script>
